<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/design/template.xhtml">
  <ui:define name="body">

  <h:form id="frmUser">
    <p:panel id="pnlUser" header="Cadastro usuário">

      <p:messages/>
      <h:panelGrid columns="3">
        <h:outputText value="Nome:" />
        <p:spacer width="8" />
        <p:inputText id="userName" value="#{userAction.user.name}" 
          required="true"
          requiredMessage="Nome obrigatório!">
        </p:inputText>
        <h:outputText value="E-mail:" />
        <p:spacer width="8" />
        <p:inputText id="userEmail" value="#{userAction.user.email}" 
          required="true"
          requiredMessage="E-mail obrigatório!" 
          validatorMessage="E-mail inválido!">
          <f:validator validatorId="emailValidator" />
        </p:inputText>
        <h:outputText value="Senha:" />
        <p:spacer width="8" />
        <p:password id="userPassword" value="#{userAction.user.password}" 
          required="true" feedback="false"
          requiredMessage="Senha obrigatória!" 
          validatorMessage="Senha inválida!">
          <f:validateLength maximum="8" minimum="6"></f:validateLength>
        </p:password>
        <h:outputText value="Confirmação:" />
        <p:spacer width="8" />
        <p:password id="userConfirmPassword" value="#{userAction.confirmPassword}" 
          required="true" feedback="false"
          requiredMessage="Confirmação obrigatória!" 
          validatorMessage="Confirmação inválida!">
          <f:validateLength maximum="8" minimum="6"></f:validateLength>
        </p:password>
      </h:panelGrid>
      <p:spacer height="10" />
      <p:outputPanel id="pnlButons">
        <div align="left" id="divButons">
          <p:commandButton action="#{userAction.initialize}" update="pnlUser" value="cancelar" ajax="false" immediate="true" />
          <p:spacer width="10" />
          <p:commandButton action="#{userAction.createUser}" update="pnlUser" value="confirmar" ajax="false" />
        </div>
      </p:outputPanel>			

    </p:panel>
  </h:form>

  </ui:define>
</ui:composition>
